package com.fastCms.business.bim.enums;

/**
 * 哈密瓜科技 版权所有 © Copyright 2019<br>
 *
 * @Description: 设备大类<br>
 * @Project: hami <br>
 * @CreateDate: Created in 2019/3/7 下午3:48 <br>
 * @Author: <a href="lsquan666@163.com">lsquan</a>
 */
public enum DeviceTypeEnum {
    TSP(11, "TSP监测仪"),
    ECMS(12, "监测设备"),
    AIR_QT(13, "空气质量微站");

    private Integer code;
    private String name;

    DeviceTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static DeviceTypeEnum getEnum(Integer code) {
        for (DeviceTypeEnum item : DeviceTypeEnum.values()) {
            if (item.code.equals(code)) {
                return item;
            }
        }
        return null;
    }

    /**
     * 根据code获取name
     *
     * @param code
     * @return
     */
    public static String getName(Integer code) {
        DeviceTypeEnum item = getEnum(code);
        return item != null ? item.name : null;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer key) {
        this.code = key;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
